package hello

import "fmt"

func FilterSlice(s []int, fn func(int) bool) []int {
	newSlice := make([]int, 0)
	for _, v := range s {
		fmt.Println(v)
		if fn(v) {
			newSlice = append(newSlice, v)
		}
	}

	return newSlice
}

func Filter(n int) bool {
	fmt.Println(n)
	if n%2 == 0 {
		return true
	}

	return false
}

func InsertStringSlice(dst []string, src []string, pos int) []string {
	length := len(dst) + len(src)
	srcLength := len(src)
	newSlice := make([]string, length)
	begin, end := dst[:pos], dst[pos:]
	copy(newSlice, begin)
	copy(newSlice[pos:pos+srcLength], src)
	copy(newSlice[pos+srcLength:], end)
	return newSlice
}
